package org.tgit.gateway.common;

/**
 * 
* @ClassName: GatewayException   
* @Description: 网关异常捕获类  
* @author fanzaijun 
* @date 2018年10月25日 下午3:29:06   
*
 */
public class GatewayException extends RuntimeException {
	
	/** @Fields fanzaijun: TODO2018年10月25日下午3:28:59*/  
	private static final long serialVersionUID = 6341003422092757965L;
	private String code;
	private String msg;

	public GatewayException(){
	}
	public GatewayException(String code) {
		super("code: "+code);
		this.code = code;
	}
	
	public GatewayException(String code , String msg) {
		super("code: " + code + " msg: " + msg);
		this.code = code;
		this.msg = msg;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		if (CommonUtil.isEmpty(msg)){
			return ApiConstants.ERROR_MAP.get(code);
		}
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
}
